<template>
	<h2>登录</h2>
	<label for="email">
		邮箱 <input type="text" name="email" id="email">
	</label>
	<label for="password">
		密码 <input type="text" name="password" id="password">
	</label>
	<input type="submit" value="提交" @click="submit">
</template>

<script setup lang="ts">
// import { GetApi } from '~/composables/api';

if (import.meta.server) {
	const data = GetApi("/api/users/currentuser");
	console.log(data, '=======');
}
const submit = () => {
	const email = document.getElementById("email") as HTMLInputElement;
	const password = document.getElementById("password") as HTMLInputElement;
	useFetch(`/api/users/signin`, {
		method: "POST",
		headers: {
			'Content-Type': 'application/json',
		},
		body: `{"email": "${email.value}","password": "${password.value}"}`
	}).then(res => {
		console.log(res);
	})
}
</script>